﻿@{
    ViewBag.Title = "AddProject";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script>
    $(document).ready(function () {
        $.ajax({
            type: "get",
            url: "/Home/typeshow",
            success: function (data) {
               
                $(data).each(function (i,obj) {
                    var option = "<option value='" + obj.id + "'>" + obj.ProjectTType + "</option>"
                    $("#projecttype").append(option);
                })
            }
        });
        $("#Button1").click(function(){
            //项目类型
            var typename = $("#projecttype").val();
            //项目名称
            var projectName = $("#projectname").val();
            //是否授权$("input[name='shi']:checked").val()
            var isShou = $("input[name='shi']:checked").val();
            //所属区域
            var area = $("#area").val();
            var isPass = $("input[name='shen']:checked").val();
            $.ajax({
                type: "get",
                url: "/Home/AddDoProject",
                data:{
                    "Tid": typename,
                    "ProjectName":projectName,
                    "YesAccredit": isShou,
                    "Area": area,
                    "ProjectState":isPass
                },
                success: function (data) {
                    if(data>0)
                    {
                        alert("新建项目成功");
                    }
                    else{
                        alert("新建醒目失败");
                    }
                }
            })
        })
    })
</script>
<h2>New Project</h2>
<div>
    <table id="tab" class="table table-condensed">

        <tr>
            <td>项目类型：</td>
            <td>
                <div class="control-group">
                    <div class="controls">
                        <select id="projecttype">
                            <option value="0">--请选择--</option>
                        </select>
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td>项目名称：</td>
            <td>
                <input id="projectname" type="text" />
            </td>
        </tr>
        <tr>
            <td>是否授权：</td>
            <td>
                <input id="projectshi" type="radio" name="shi" value="是"  checked="checked"/>是
                <input id="projectfou" type="radio" name="shi" value="否" />否
            </td>
        </tr>
        <tr>
            <td>所属区域：</td>
            <td>
               <input  type="text" id="area" />
            </td>
        </tr>
        <tr>
            <td>状态：</td>
            <td>
                <input id="projectstate" type="radio" name="shen" value="审核通过" />审核通过
                <input id="projectstate" type="radio" name="shen" checked="checked" value="审核未通过"/>审核未通过
            </td>
        </tr>
        <tr>
            <td></td>
            <td><input id="Button1" type="button" value="添加" /></td>
        </tr>
    </table>
</div>